import 'package:shared_preferences/shared_preferences.dart';

class LanguageService {
  static void setLanguage(String languageCode, String countryCode) async {
    final prefs = await SharedPreferences.getInstance();
    prefs.setString("languageCode", languageCode);
    prefs.setString("countryCode", countryCode);
  }

  static void setLanguageName(String language) async {
    final prefs = await SharedPreferences.getInstance();
    prefs.setString("language-name", language);
  }

  static Future<String> getLanguageName() async {
    String? name = "选择语言";
    final prefs = await SharedPreferences.getInstance();
    if (prefs.getString('language-name') != null) {
      name = prefs.getString("language-name");
    }
    return name!;
  }
}
